package double_pointer;

/**
 * @Description 剑指 Offer 57. 和为s的两个数字
 * @Author Firenut
 * @Date 2023-01-25 22:29
 */
public class T57_I_singleNumber {
    public int[] twoSum(int[] nums, int target) {
        int i=0,j=nums.length-1;
        while(i<j){
            if(nums[i]+nums[j]>target){
                j--;
            }else if(nums[i]+nums[j]==target){
                return new int[]{nums[i],nums[j]};
            }else{
                i++;
            }
        }
        return new int[0];
    }
}